<template>

  <!--开始必须新建一个div根目录-->
  <div>
    <p>图片<input type="file" name="pic" id="pic"></p>
    <p>地址 <input type="text" placeholder="请输入网址" v-model="form.urls">
      <button><a href="http:\\www.baidu.com">百度</a></button></p>
    <p>类型<input type="text" v-model="form.type"></p>
    <p>
      <button @click="add">添加广告</button>
    </p>



<!--    <h1>展示广告页面</h1>-->
<!--    {{ show_list }}-->
<!--    {{tpage}}-->
  </div>
</template>

<script>
export default {
  name: "advertising",
  data() {
    return {
      form:{},
      // show_list:[],
      // tpage:0
    }
  },

  methods: {
    add() {
      let pic = document.getElementById('pic').files[0]
      let formdata = new FormData()
      formdata.append('pic',pic)
      formdata.append('type',this.form.type)
      formdata.append('type',this.form.urls)
      this.$axios.post('users/advertisingM/',formdata)
      .then(res=>{
        console.log(res.data)
        if(res.data.code==200){
          alert('添加成功')
        }else{
          alert("添加失败")
        }
      })
    },


    // show_gg(cpage){
    //   this.$axios.get('users/advertisingM/?cpage='+cpage)
    //   .then(res=>{
    //     console.log(res.data)
    //     this.show_list = res.data.list
    //     this.tpage = res.data.tpage
    //   })
    // }
  },

  computed: {},

  mounted() {
    // this.show_gg(1)
  }
}
</script>

<style scoped>

</style>
